home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 125
/
Freelog_MarsAvril2015_No125.iso
/
Musique
/
Quod Libet
/
quodlibet-3.3.0-installer.exe
/
bin
/
genericpath.pyc
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2014-12-31
|
3KB
|
105 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.7)
'''
Path operations common to more than one OS
Do not use directly. The OS specific modules import the appropriate
functions from this module themselves.
'''
import os
import stat
__all__ = [
'commonprefix',
'exists',
'getatime',
'getctime',
'getmtime',
'getsize',
'isdir',
'isfile']
def exists(path):
'''Test whether a path exists. Returns False for broken symbolic links'''
try:
os.stat(path)
except os.error:
return False
return True
def isfile(path):
'''Test whether a path is a regular file'''
try:
st = os.stat(path)
except os.error:
return False
return stat.S_ISREG(st.st_mode)
def isdir(s):
'''Return true if the pathname refers to an existing directory.'''
try:
st = os.stat(s)
except os.error:
return False
return stat.S_ISDIR(st.st_mode)
def getsize(filename):
'''Return the size of a file, reported by os.stat().'''
return os.stat(filename).st_size
def getmtime(filename):
'''Return the last modification time of a file, reported by os.stat().'''
return os.stat(filename).st_mtime
def getatime(filename):
'''Return the last access time of a file, reported by os.stat().'''
return os.stat(filename).st_atime
def getctime(filename):
'''Return the metadata change time of a file, reported by os.stat().'''
return os.stat(filename).st_ctime
def commonprefix(m):
'''Given a list of pathnames, returns the longest common leading component'''
if not m:
return ''
s1 = None(m)
s2 = max(m)
for i, c in enumerate(s1):
if c != s2[i]:
return s1[:i]
return s1
def _splitext(p, sep, altsep, extsep):
'''Split the extension from a pathname.
Extension is everything from the last dot to the end, ignoring
leading dots. Returns "(root, ext)"; ext may be empty.'''
sepIndex = p.rfind(sep)
if altsep:
altsepIndex = p.rfind(altsep)
sepIndex = max(sepIndex, altsepIndex)
dotIndex = p.rfind(extsep)
if dotIndex > sepIndex:
filenameIndex = sepIndex + 1
while filenameIndex < dotIndex:
if p[filenameIndex] != extsep:
return (p[:dotIndex], p[dotIndex:])
None += 1
return (p, '')